From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx@qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx@qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx@qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi@qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces@qbang.org [mailto:rxtx-bounces@qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi@qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi@qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin@exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi@qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi@qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi@qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi@qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx@qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi@qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx@qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx@qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx@qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen@lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi@qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi@qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi@qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi@qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi@qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi@qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx@qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi@qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx@qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx@qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx@qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx@qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx@qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx@qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx@qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx@qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx@qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx@qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx@qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx@qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx@qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi@qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi@qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Tue Mar 14 23:22:10 2006 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0001.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0001.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx@qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0001.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx@qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx@qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi@qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0001.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0001.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces@qbang.org [mailto:rxtx-bounces@qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi@qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi@qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin@exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi@qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi@qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi@qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi@qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx@qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi@qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx@qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx@qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx@qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen@lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi@qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi@qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi@qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi@qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0001.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi@qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi@qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx@qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi@qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx@qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx@qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx@qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx@qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx@qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx@qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx@qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx@qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx@qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx@qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx@qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx@qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx@qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi@qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi@qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Tue Mar 28 18:25:36 2006 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Tue Mar 28 20:17:29 2006 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0002.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0002.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx@qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0002.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx@qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx@qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi@qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0002.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0002.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces@qbang.org [mailto:rxtx-bounces@qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi@qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi@qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin@exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi@qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi@qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi@qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi@qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx@qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi@qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx@qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx@qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx@qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen@lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi@qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi@qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi@qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi@qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0002.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi@qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi@qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx@qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi@qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx@qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx@qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx@qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx@qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx@qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx@qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx@qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx@qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx@qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx@qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx@qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx@qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx@qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx@qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi@qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi@qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Tue Mar 28 20:17:30 2006 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0003.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0003.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0003.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0003.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0003.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0003.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0004.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0004.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0004.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0004.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0004.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0004.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0005.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0005.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0005.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0005.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0005.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0005.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0006.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0006.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0006.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0006.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0006.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0006.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0007.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0007.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0007.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0007.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0007.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0007.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0008.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0008.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0008.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0008.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0008.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0008.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0009.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0009.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0009.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0009.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0009.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0009.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0010.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0010.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0010.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0010.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0010.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0010.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0011.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0011.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0011.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0011.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0011.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0011.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0012.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0012.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0012.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0012.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0012.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0012.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0013.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0013.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0013.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0013.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0013.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0013.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0014.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0014.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0014.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0014.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0014.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0014.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0015.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0015.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0015.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0015.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0015.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0015.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0016.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0016.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0016.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0016.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0016.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0016.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0017.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0017.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0017.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0017.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0017.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0017.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0018.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0018.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0018.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0018.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0018.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0018.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0019.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0019.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0019.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0019.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0019.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0019.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0020.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0020.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0020.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0020.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0020.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0020.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0021.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0021.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0021.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0021.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0021.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0021.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0022.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0022.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0022.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0022.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0022.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0022.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0023.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0023.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0023.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0023.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0023.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0023.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0024.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0024.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0024.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0024.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0024.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0024.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0025.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0025.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0025.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0025.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0025.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0025.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0026.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0026.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0026.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0026.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0026.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0026.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0027.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0027.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0027.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0027.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0027.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0027.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0028.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0028.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0028.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0028.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0028.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0028.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0029.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0029.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0029.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0029.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0029.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0029.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0030.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0030.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0030.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0030.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0030.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0030.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0031.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0031.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0031.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0031.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0031.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0031.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0032.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0032.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0032.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0032.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0032.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0032.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0033.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0033.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0033.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0033.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0033.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0033.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0034.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0034.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0034.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0034.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0034.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0034.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0035.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0035.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0035.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0035.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0035.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0035.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0036.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0036.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0036.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0036.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0036.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0036.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0037.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0037.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0037.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0037.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0037.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0037.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0038.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0038.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0038.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0038.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0038.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0038.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0039.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0039.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0039.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0039.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0039.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0039.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0040.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0040.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0040.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0040.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0040.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0040.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0041.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0041.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0041.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0041.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0041.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0041.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0042.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0042.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0042.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0042.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0042.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0042.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0043.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0043.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0043.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0043.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0043.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0043.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0044.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0044.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0044.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0044.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0044.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0044.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0045.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0045.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0045.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0045.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0045.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0045.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0046.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0046.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0046.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0046.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0046.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0046.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0047.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0047.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0047.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0047.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0047.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0047.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0048.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0048.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0048.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0048.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0048.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0048.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0049.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0049.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0049.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0049.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0049.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0049.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0050.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0050.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0050.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0050.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0050.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0050.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx.